package service

import (
	"errors"
	"gold_task/db/dao"

	"github.com/gin-gonic/gin"
)

type MiniReq struct {
	APPID   string
	OPENID  string
	UNIONID string
}

func GetTaskList(c *gin.Context) {
	task, err := dao.GetTaskList()
	if err != nil {
		c.Error(errors.New("内部错误"))
		return
	}
	c.JSON(200, gin.H{
		"code": 0,
		"data": task,
	})
}

func GetMyReviewItems(c *gin.Context) {
	openId := c.GetHeader("X-Wx-Openid")
	items, err := dao.GetReviewItemList(openId)
	if err != nil {
		c.Error(errors.New("内部错误"))
		return
	}
	c.JSON(200, gin.H{
		"code": 0,
		"data": items,
	})
}
